import Vue from 'vue'
import Vuex from 'vuex'
import {fetchWheelList} from './service';

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    title: "首页",
    wheelList: [],
  },
  mutations: {
    UPDATEWHEELLIST(state, {wheelList}) {
      state.wheelList = wheelList;
    }
  },
  actions: {
    async updateWheelList(context) {
      var wheelList = await fetchWheelList();
      context.commit("UPDATEWHEELLIST", {
        wheelList: wheelList['top_stories']
      });
    }
  }
})
